<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Idioma extends CMS_Controller {

    function __construct() {
        parent::__construct();
        //echo $this->session->userdata('idioma');
        $this->load->library('session');
        $this->load->add_module('local');
        $this->load->config('local/parametros');
        $this->load->model('local/local_idiomas_model');
        
    }

      public function mudar($_lang) {

        if (isset($_SERVER['HTTP_REFERER'])) {

            $url = $_SERVER['HTTP_REFERER'];
        } else {
            $url = base_url();
        }
        $sessao = array(
            'idioma' => $_lang
        );

        $this->session->unset_userdata($sessao);
        $this->session->set_userdata($sessao);

        redirect($url, "refresh");
    }
}